<?php
// 获取一条优惠券
require $this->website['path']['action'] . '/admin/isadmin.php';

$json = array('status' => 'error', 'msg' => '', 'data' => '');

$id = fn_post('id');

if (!$id || !is_numeric($id)) {
	$json['msg'] = '错误优惠券编号';
} elseif (!$this->website['class']['db']
		->table('coupon')
		->where('id=?', $id)
		->limit(1)
		->count()) {
	$json['msg'] = '未找到优惠券或已被删除';
} else {
	$json['status'] = 'ok';
	$json['data'] = $this->website['class']['db']
		->table('coupon')
		->where('id=?', $id)
		->one();
}

$this->json_encode($json);